function toIndex(){
    var username=$("#username").val();
    if(!username){
        $("#username").attr("placeholder","请先输入账号");
        return;
    }
    $.post("doToIndex",{"username":username},function(result){
        if(result.state==1){
            if(result.data.length>0){
                $("#loginForm").submit();
            }else{
                $("#username").val("");
                $("#username").attr("placeholder","输入的账号不正确");
                return;
            }
        }
    })

}
/***
 * @param {string} cookieName Cookie名称
 * @param {string} cookieValue Cookie值
 * @param {number} nDays Cookie过期天数
 */
function SetCookie(cookieName,cookieValue,nDays) {
    /*当前日期*/
    var today = new Date();
    /*Cookie过期时间*/
    var expire = new Date();
    /*如果未设置nDays参数或者nDays为0，取默认值1*/
    if(nDays == null || nDays == 0) nDays = 1;
    /*计算Cookie过期时间*/
    expire.setTime(today.getTime() + 3600000 * 24 * nDays);
    /*设置Cookie值*/
    document.cookie = cookieName + "=" + escape(cookieValue)
        + ";expires=" + expire.toGMTString();
}